<?php
class StringUtility
{
    public static function toUnderscore($camel)
    {
        $pattern = '/([a-z])([A-Z])/e';
        $replace = "'\${1}_' . strtolower('\${2}')";
        return lcfirst(preg_replace($pattern, $replace, $camel));
    }
}